/**
 * 
 */
package org.vsg.stock.basic.service.handler;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.vsg.stock.basic.domain.StockDayIndicator;
import org.vsg.stock.core.domain.StockTick;

/**
 * @author vison
 *
 */
public class CommonTradeTickNatureHandler implements TradeTickNatureHandler {

	/**
	 * set the logger for developer code , do not use System.print(ln) to out print message.
	 */
	private static final Logger logger = LoggerFactory.getLogger(CommonTradeTickNatureHandler.class);
	
	
	/* (non-Javadoc)
	 * @see org.vsg.stock.basic.service.handler.TradeTickNatureHandler#handle(java.util.Map, org.vsg.stock.basic.domain.StockDayIndicator, java.util.List, int, double, double)
	 */
	@Override
	public short handle(StockDayIndicator indicator, List<StockTick> stockTickList,
			int index, double bigOrdLevel, double midBigOrdLevel) {
		// TODO Auto-generated method stub
		
		StockTick st = stockTickList.get(index);
		StockTick lastSt = stockTickList.get(index-1);
		StockTick nextSt = stockTickList.get(index+1);


		boolean c1 = false;
		
		if (st.getTickType().equals("buy")) {

			if (lastSt.getConsignedBuy1Price() >= st.getConsignedBuy1Price()) {
				c1 = true;
			}
			
		} else if (st.getTickType().equals("sell")) {
			
		}
		
			

		if (c1) {
			logger.debug("stock ["+indicator.getStockCode()+"] time: " + st.getDateTime() + " , tick:" + st.getPresentTickVol() );
		}
	
		
		
		return TradeTickNatureHandler.SKIP;
	}


	@Override
	public double getAmount() {
		// TODO Auto-generated method stub
		return 0;
	}


	@Override
	public long getVol() {
		// TODO Auto-generated method stub
		return 0;
	}

	
	
}
